import axios from 'axios'

export let getSwiper=()=>{
    return (dispatch) =>{
        axios.get('/api/swiper').then(res =>{
            console.log(res.data)
            dispatch({
                type:"GET_SWIPER",
                payload:res.data
            })
        })
    }
}

export let getList =()=>{
    return (dispatch) =>{
        axios.get('/api/list').then(res =>{
            console.log(res.data)
            dispatch({
                type:"GET_LIST",
                payload:res.data
            })
        })
    }
}

export let changIndex=(inds)=>{
    return (dispatch)=>{
        dispatch({
            type:"C_INDEX",
            payload:inds
        })
    }
}

export let getDetail=(ids)=>{
    return (dispatch)=>{
        dispatch({
            type:"GET_DETAIL",
            payload:ids
        })
    }
}

export let addShop=(ids)=>{
    return (dispatch)=>{
        dispatch({
            type:"ADD_CART",
            payload:ids
        })
    }
}

export let setLike=(ids)=>{
    return (dispatch)=>{
        dispatch({
            type:"SET_LIKE",
            payload:ids
        })
    }
}